home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Examples / Button / Include / ButtonPart.h < prev    next >
Encoding:
Text File  |  1995-11-08  |  4.8 KB  |  176 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                ButtonPart.h
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Author:                Henri Lamiraux
  7. //    Modified by M.Boetcher to accept Dropped and Pasted sounds
  8. //
  9. //    Copyright:    © 1993, 1995 by Apple Computer, Inc., all rights reserved.
  10. //
  11. //========================================================================================
  12.  
  13. #ifndef BUTTONPART_H
  14. #define BUTTONPART_H
  15.  
  16. // ----- Framework Layer -----
  17.  
  18. #ifndef FWPART_H
  19. #include "FWPart.h"
  20. #endif
  21.  
  22. #ifndef FWFRAME_H
  23. #include "FWFrame.h"
  24. #endif
  25.  
  26. // ----- Foundation Layer -----
  27.  
  28. #ifndef FWHFCONN_H
  29. #include "FWHFConn.h"
  30. #endif
  31.  
  32. //========================================================================================
  33. // Forward Declarations
  34. //========================================================================================
  35.  
  36. #if FW_LIB_EXPORT_PRAGMAS
  37. #pragma import on
  38. #endif
  39. class FW_CLASS_ATTR FW_CNotification;
  40. class FW_CLASS_ATTR FW_CHandleFunctionConnection;
  41. class FW_CLASS_ATTR FW_CPushButton;
  42. #if FW_LIB_EXPORT_PRAGMAS
  43. #pragma import off
  44. #endif
  45.  
  46. //========================================================================================
  47. //    Forward declarations
  48. //========================================================================================
  49.  
  50. class CAction;
  51.  
  52. //========================================================================================
  53. //    class CButtonPart
  54. //========================================================================================
  55.  
  56. class FW_CLASS_ATTR CButtonPart : public FW_CPart
  57. {
  58. public:
  59.     static const ODValueType kPartKind;
  60.     static const ODValueType kPartUserName;
  61.  
  62. //----------------------------------------------------------------------------------------
  63. //    Initialization/Destruction
  64. //
  65. public:
  66.     CButtonPart(ODPart* odPart);
  67.     virtual ~CButtonPart();
  68.     
  69.     virtual void    Initialize(Environment* ev);
  70.     
  71. //----------------------------------------------------------------------------------------
  72. //    Inherited API
  73. //
  74.   public:
  75.     virtual FW_CFrame* NewFrame(Environment* ev,
  76.                             ODFrame* odFrame,
  77.                             FW_CPresentation* presentation,
  78.                             FW_Boolean fromStorage);
  79.     
  80.     virtual void InternalizeContent(Environment* ev, 
  81.                             ODStorageUnit* storage, 
  82.                             FW_CCloneInfo* cloneInfo);
  83.                                 
  84.     virtual void ExternalizeContent(Environment* ev, 
  85.                             ODStorageUnit* storage, 
  86.                             FW_CCloneInfo* cloneInfo);
  87.  
  88. //----------------------------------------------------------------------------------------
  89. //    New API
  90. //
  91.   public:
  92.       CAction*            GetAction() { return fAction; }
  93.       void                SetAction(CAction* action);
  94.  
  95.   public:
  96.     void                DoAction();
  97.  
  98. //----------------------------------------------------------------------------------------
  99. //    Data Members
  100. //
  101.   private:
  102.     CAction*            fAction;
  103. };
  104.  
  105. //========================================================================================
  106. //    class CButtonFrame
  107. //========================================================================================
  108.  
  109. class FW_CLASS_ATTR CButtonFrame : public FW_CFrame
  110. {
  111. //----------------------------------------------------------------------------------------
  112. //    Initialization/Destruction
  113. //
  114. public:
  115.     CButtonFrame(Environment* ev, ODFrame* frame, 
  116.         FW_CPresentation* presentation, CButtonPart* part);    
  117.     virtual ~CButtonFrame();
  118.  
  119. //----------------------------------------------------------------------------------------
  120. //    FW_CFrame overrides
  121. //
  122. public:
  123.     virtual void             CreateSubViews(Environment* ev);
  124.     virtual void             AdjustSubViews(Environment* ev);
  125.  
  126.     virtual ODDragResult     CanAcceptDrop(Environment* ev, 
  127.                                 ODDragItemIterator* dragInfo);
  128.  
  129.     virtual void             Draw(Environment* ev, 
  130.                                 ODFacet* facet, 
  131.                                 ODShape* invalidShape);
  132.  
  133.     virtual void            FocusStateChanged(Environment *ev, 
  134.                                 ODTypeToken focus, 
  135.                                 FW_Boolean newState, 
  136.                                 ODFrame* newOwner);
  137.  
  138. //----------------------------------------------------------------------------------------
  139. //    FW_MReceiver overrides
  140. //
  141. public:
  142.     virtual void             HandleNotification(
  143.                                 const FW_CNotification& notification);
  144.  
  145. //----------------------------------------------------------------------------------------
  146. //    Data Members
  147. //
  148. private:
  149.     CButtonPart*                    fButtonPart;
  150.     FW_CPushButton*                    fButton;
  151.     ODID                            fButtonId;
  152.     FW_CHandleFunctionConnection     fConnection;
  153.     ODTypeToken                        fButtonNotificationToken;
  154. };
  155.  
  156. //========================================================================================
  157. //    class COptionBehavior
  158. //========================================================================================
  159.  
  160. class COptionBehavior : public FW_MEventHandler
  161. {
  162. public:
  163.     COptionBehavior(Environment* ev, CButtonFrame* frame, ODSession* session);
  164.     virtual ~COptionBehavior();
  165.  
  166. public:
  167.     virtual FW_Boolean    DoMouseDown(Environment* ev, const FW_CMouseEvent& theMouseEvent);
  168.     
  169. private:
  170.     CButtonFrame*        fFrame;
  171.     FW_CFocusSet        fFullFocusSet;
  172.     FW_CFocusSet        fEmptyFocusSet;
  173. };
  174.  
  175. #endif
  176.